<template>
  <nm-container>
    <nm-list ref="list" v-bind="list">
      <!--查询条件-->
      <template v-slot:querybar>
        <el-form-item label="用户名：" prop="userName">
          <el-input v-model="list.model.userName" clearable />
        </el-form-item>
        <el-form-item label="密码：" prop="password">
          <el-input v-model="list.model.password" clearable />
        </el-form-item>
        <el-form-item label="昵称：" prop="nickName">
          <el-input v-model="list.model.nickName" clearable />
        </el-form-item>
        <el-form-item label="真实姓名：" prop="realName">
          <el-input v-model="list.model.realName" clearable />
        </el-form-item>
        <el-form-item label="用户头像：" prop="userPhoto">
          <el-input v-model="list.model.userPhoto" clearable />
        </el-form-item>
        <el-form-item label="手机：" prop="phone">
          <el-input v-model="list.model.phone" clearable />
        </el-form-item>
        <el-form-item label="生日：" prop="brithday">
          <el-input v-model="list.model.brithday" clearable />
        </el-form-item>
        <el-form-item label="QQ：" prop="qQ">
          <el-input v-model="list.model.qQ" clearable />
        </el-form-item>
        <el-form-item label="邮箱：" prop="email">
          <el-input v-model="list.model.email" clearable />
        </el-form-item>
        <el-form-item label="用户积分：" prop="score">
          <el-input v-model="list.model.score" clearable />
        </el-form-item>
        <el-form-item label="用户历史消费总积分：" prop="totalScore">
          <el-input v-model="list.model.totalScore" clearable />
        </el-form-item>
        <el-form-item label="最后登录IP：" prop="lastLoginIP">
          <el-input v-model="list.model.lastLoginIP" clearable />
        </el-form-item>
        <el-form-item label="最后登录时间：" prop="lastLoginTime">
          <el-input v-model="list.model.lastLoginTime" clearable />
        </el-form-item>
        <el-form-item label="钱包金额：" prop="walletMoney">
          <el-input v-model="list.model.walletMoney" clearable />
        </el-form-item>
        <el-form-item label="冻结金额：" prop="freezeMoney">
          <el-input v-model="list.model.freezeMoney" clearable />
        </el-form-item>
        <el-form-item label="用户状态：" prop="userStatus">
          <el-input v-model="list.model.userStatus" clearable />
        </el-form-item>
        <el-form-item label="支付密码：" prop="payPassword">
          <el-input v-model="list.model.payPassword" clearable />
        </el-form-item>
      </template>

      <!--按钮-->
      <template v-slot:querybar-buttons>
        <nm-button v-bind="buttons.add" @click="add" />
      </template>

      <!--自定义列-->
      <!-- <template v-slot:col-name="{row}">
        <nm-button :text="row.name" type="text" />
      </template> -->

      <!--操作列-->
      <template v-slot:col-operation="{ row }">
        <nm-button v-bind="buttons.edit" @click="edit(row)" />
        <nm-button-delete v-bind="buttons.del" :id="row.id" :action="removeAction" @success="refresh" />
      </template>
    </nm-list>

    <save-page :id="curr.id" :visible.sync="dialog.save" @success="refresh" />
  </nm-container>
</template>
<script>
import { mixins } from 'nbmodular-ui'
import page from './page'
import cols from './cols'
import SavePage from '../components/save'

const api = $api.member.user

export default {
  name: page.name,
  mixins: [mixins.list],
  components: { SavePage },
  data() {
    return {
      list: {
        title: page.title,
        cols,
        action: api.query,
        model: {
          /** 用户名 */
          userName: '',
          /** 密码 */
          password: '',
          /** 昵称 */
          nickName: '',
          /** 真实姓名 */
          realName: '',
          /** 用户头像 */
          userPhoto: '',
          /** 手机 */
          phone: '',
          /** 生日 */
          brithday: '',
          /** QQ */
          qQ: '',
          /** 邮箱 */
          email: '',
          /** 用户积分 */
          score: '',
          /** 用户历史消费总积分 */
          totalScore: '',
          /** 最后登录IP */
          lastLoginIP: '',
          /** 最后登录时间 */
          lastLoginTime: '',
          /** 钱包金额 */
          walletMoney: '',
          /** 冻结金额 */
          freezeMoney: '',
          /** 用户状态 */
          userStatus: '',
          /** 支付密码 */
          payPassword: ''
        }
      },
      removeAction: api.remove,
      buttons: page.buttons
    }
  }
}
</script>
